<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="GNU source-highlight 1.6.3
by Lorenzo Bettini, bettini@gnu.org
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite">
<title>code/Ch2/mail/Connection.java</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<pre>
<tt>
001: <i><font color=#9A1900>/**</font></i>
002: <i><font color=#9A1900>   Connects a phone to the mail system. The purpose of this</font></i>
003: <i><font color=#9A1900>   class is to keep track of the state of a connection, since</font></i>
004: <i><font color=#9A1900>   the phone itself is just a source of individual key presses.</font></i>
005: <i><font color=#9A1900>*/</font></i>
006: <b><font color=#0000FF>public</font></b> <b><font color=#0000FF>class</font></b> Connection
007: <font color=#FF0000>{</font>
008:    <i><font color=#9A1900>/**</font></i>
009: <i><font color=#9A1900>      Construct a Connection object.</font></i>
010: <i><font color=#9A1900>      @param s a MailSystem object</font></i>
011: <i><font color=#9A1900>      @param p a Telephone object</font></i>
012: <i><font color=#9A1900>   */</font></i>
013:    <b><font color=#0000FF>public</font></b> <b><font color=#000000>Connection</font></b><font color=#990000>(</font>MailSystem s<font color=#990000>,</font> Telephone p<font color=#990000>)</font>
014:    <font color=#FF0000>{</font>
015:       system <font color=#990000>=</font> s<font color=#990000>;</font>
016:       phone <font color=#990000>=</font> p<font color=#990000>;</font>
017:       <b><font color=#000000>resetConnection</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
018:    <font color=#FF0000>}</font>
019: 
020:    <i><font color=#9A1900>/**</font></i>
021: <i><font color=#9A1900>      Respond to the user's pressing a key on the phone touchpad</font></i>
022: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
023: <i><font color=#9A1900>   */</font></i>
024:    <b><font color=#0000FF>public</font></b> <font color=#009900>void</font> <b><font color=#000000>dial</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
025:    <font color=#FF0000>{</font>
026:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> CONNECTED<font color=#990000>)</font>
027:          <b><font color=#000000>connect</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
028:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> RECORDING<font color=#990000>)</font>
029:          <b><font color=#000000>login</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
030:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> CHANGE_PASSCODE<font color=#990000>)</font>
031:          <b><font color=#000000>changePasscode</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
032:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> CHANGE_GREETING<font color=#990000>)</font>
033:          <b><font color=#000000>changeGreeting</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
034:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> MAILBOX_MENU<font color=#990000>)</font>
035:          <b><font color=#000000>mailboxMenu</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
036:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> MESSAGE_MENU<font color=#990000>)</font>
037:          <b><font color=#000000>messageMenu</font></b><font color=#990000>(</font>key<font color=#990000>)</font><font color=#990000>;</font>
038:    <font color=#FF0000>}</font>
039: 
040:    <i><font color=#9A1900>/**</font></i>
041: <i><font color=#9A1900>      Record voice.</font></i>
042: <i><font color=#9A1900>      @param voice voice spoken by the user</font></i>
043: <i><font color=#9A1900>   */</font></i>
044:    <b><font color=#0000FF>public</font></b> <font color=#009900>void</font> <b><font color=#000000>record</font></b><font color=#990000>(</font>String voice<font color=#990000>)</font>
045:    <font color=#FF0000>{</font>
046:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> RECORDING <font color=#990000>|</font><font color=#990000>|</font> state <font color=#990000>=</font><font color=#990000>=</font> CHANGE_GREETING<font color=#990000>)</font>
047:          currentRecording <font color=#990000>+</font><font color=#990000>=</font> voice<font color=#990000>;</font>
048:    <font color=#FF0000>}</font>
049: 
050:    <i><font color=#9A1900>/**</font></i>
051: <i><font color=#9A1900>      The user hangs up the phone.</font></i>
052: <i><font color=#9A1900>   */</font></i>
053:    <b><font color=#0000FF>public</font></b> <font color=#009900>void</font> <b><font color=#000000>hangup</font></b><font color=#990000>(</font><font color=#990000>)</font>
054:    <font color=#FF0000>{</font>
055:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>state <font color=#990000>=</font><font color=#990000>=</font> RECORDING<font color=#990000>)</font>
056:          currentMailbox<font color=#990000>.</font><b><font color=#000000>addMessage</font></b><font color=#990000>(</font><b><font color=#0000FF>new</font></b> <b><font color=#000000>Message</font></b><font color=#990000>(</font>currentRecording<font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
057:       <b><font color=#000000>resetConnection</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
058:    <font color=#FF0000>}</font>
059: 
060:    <i><font color=#9A1900>/**</font></i>
061: <i><font color=#9A1900>      Reset the connection to the initial state and prompt</font></i>
062: <i><font color=#9A1900>      for mailbox number</font></i>
063: <i><font color=#9A1900>   */</font></i>
064:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>resetConnection</font></b><font color=#990000>(</font><font color=#990000>)</font>
065:    <font color=#FF0000>{</font>
066:       currentRecording <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
067:       accumulatedKeys <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
068:       state <font color=#990000>=</font> CONNECTED<font color=#990000>;</font>
069:       phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>INITIAL_PROMPT<font color=#990000>)</font><font color=#990000>;</font>
070:    <font color=#FF0000>}</font>
071: 
072:    <i><font color=#9A1900>/**</font></i>
073: <i><font color=#9A1900>      Try to connect the user with the specified mailbox.</font></i>
074: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
075: <i><font color=#9A1900>   */</font></i>
076:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>connect</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
077:    <font color=#FF0000>{</font>
078:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"#"</font><font color=#990000>)</font><font color=#990000>)</font>
079:       <font color=#FF0000>{</font>
080:          currentMailbox <font color=#990000>=</font> system<font color=#990000>.</font><b><font color=#000000>findMailbox</font></b><font color=#990000>(</font>accumulatedKeys<font color=#990000>)</font><font color=#990000>;</font>
081:          <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>currentMailbox <font color=#990000>!</font><font color=#990000>=</font> <b><font color=#0000FF>null</font></b><font color=#990000>)</font>
082:          <font color=#FF0000>{</font>
083:             state <font color=#990000>=</font> RECORDING<font color=#990000>;</font>
084:             phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>currentMailbox<font color=#990000>.</font><b><font color=#000000>getGreeting</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
085:          <font color=#FF0000>}</font>
086:          <b><font color=#0000FF>else</font></b>
087:             phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font><font color=#FF0000>"Incorrect mailbox number. Try again!"</font><font color=#990000>)</font><font color=#990000>;</font>
088:          accumulatedKeys <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
089:       <font color=#FF0000>}</font>
090:       <b><font color=#0000FF>else</font></b>
091:          accumulatedKeys <font color=#990000>+</font><font color=#990000>=</font> key<font color=#990000>;</font>
092:    <font color=#FF0000>}</font>
093: 
094:    <i><font color=#9A1900>/**</font></i>
095: <i><font color=#9A1900>      Try to log in the user.</font></i>
096: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
097: <i><font color=#9A1900>   */</font></i>
098:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>login</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
099:    <font color=#FF0000>{</font>
100:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"#"</font><font color=#990000>)</font><font color=#990000>)</font>
101:       <font color=#FF0000>{</font>
102:          <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>currentMailbox<font color=#990000>.</font><b><font color=#000000>checkPasscode</font></b><font color=#990000>(</font>accumulatedKeys<font color=#990000>)</font><font color=#990000>)</font>
103:          <font color=#FF0000>{</font>
104:             state <font color=#990000>=</font> MAILBOX_MENU<font color=#990000>;</font>
105:             phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MAILBOX_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
106:          <font color=#FF0000>}</font>
107:          <b><font color=#0000FF>else</font></b>
108:             phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font><font color=#FF0000>"Incorrect passcode. Try again!"</font><font color=#990000>)</font><font color=#990000>;</font>
109:          accumulatedKeys <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
110:       <font color=#FF0000>}</font>
111:       <b><font color=#0000FF>else</font></b>
112:          accumulatedKeys <font color=#990000>+</font><font color=#990000>=</font> key<font color=#990000>;</font>
113:    <font color=#FF0000>}</font>
114: 
115:    <i><font color=#9A1900>/**</font></i>
116: <i><font color=#9A1900>      Change passcode.</font></i>
117: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
118: <i><font color=#9A1900>   */</font></i>
119:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>changePasscode</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
120:    <font color=#FF0000>{</font>
121:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"#"</font><font color=#990000>)</font><font color=#990000>)</font>
122:       <font color=#FF0000>{</font>
123:          currentMailbox<font color=#990000>.</font><b><font color=#000000>setPasscode</font></b><font color=#990000>(</font>accumulatedKeys<font color=#990000>)</font><font color=#990000>;</font>
124:          state <font color=#990000>=</font> MAILBOX_MENU<font color=#990000>;</font>
125:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MAILBOX_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
126:          accumulatedKeys <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
127:       <font color=#FF0000>}</font>
128:       <b><font color=#0000FF>else</font></b>
129:          accumulatedKeys <font color=#990000>+</font><font color=#990000>=</font> key<font color=#990000>;</font>
130:    <font color=#FF0000>}</font>
131: 
132:    <i><font color=#9A1900>/**</font></i>
133: <i><font color=#9A1900>      Change greeting.</font></i>
134: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
135: <i><font color=#9A1900>   */</font></i>
136:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>changeGreeting</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
137:    <font color=#FF0000>{</font>
138:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"#"</font><font color=#990000>)</font><font color=#990000>)</font>
139:       <font color=#FF0000>{</font>
140:          currentMailbox<font color=#990000>.</font><b><font color=#000000>setGreeting</font></b><font color=#990000>(</font>currentRecording<font color=#990000>)</font><font color=#990000>;</font>
141:          currentRecording <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
142:          state <font color=#990000>=</font> MAILBOX_MENU<font color=#990000>;</font>
143:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MAILBOX_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
144:       <font color=#FF0000>}</font>
145:    <font color=#FF0000>}</font>
146: 
147:    <i><font color=#9A1900>/**</font></i>
148: <i><font color=#9A1900>      Respond to the user's selection from mailbox menu.</font></i>
149: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
150: <i><font color=#9A1900>   */</font></i>
151:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>mailboxMenu</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
152:    <font color=#FF0000>{</font>
153:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"1"</font><font color=#990000>)</font><font color=#990000>)</font>
154:       <font color=#FF0000>{</font>
155:          state <font color=#990000>=</font> MESSAGE_MENU<font color=#990000>;</font>
156:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MESSAGE_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
157:       <font color=#FF0000>}</font>
158:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"2"</font><font color=#990000>)</font><font color=#990000>)</font>
159:       <font color=#FF0000>{</font>
160:          state <font color=#990000>=</font> CHANGE_PASSCODE<font color=#990000>;</font>
161:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font><font color=#FF0000>"Enter new passcode followed by the # key"</font><font color=#990000>)</font><font color=#990000>;</font>
162:       <font color=#FF0000>}</font>
163:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"3"</font><font color=#990000>)</font><font color=#990000>)</font>
164:       <font color=#FF0000>{</font>
165:          state <font color=#990000>=</font> CHANGE_GREETING<font color=#990000>;</font>
166:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font><font color=#FF0000>"Record your greeting, then press the # key"</font><font color=#990000>)</font><font color=#990000>;</font>
167:       <font color=#FF0000>}</font>
168:    <font color=#FF0000>}</font>
169: 
170:    <i><font color=#9A1900>/**</font></i>
171: <i><font color=#9A1900>      Respond to the user's selection from message menu.</font></i>
172: <i><font color=#9A1900>      @param key the phone key pressed by the user</font></i>
173: <i><font color=#9A1900>   */</font></i>
174:    <b><font color=#0000FF>private</font></b> <font color=#009900>void</font> <b><font color=#000000>messageMenu</font></b><font color=#990000>(</font>String key<font color=#990000>)</font>
175:    <font color=#FF0000>{</font>
176:       <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"1"</font><font color=#990000>)</font><font color=#990000>)</font>
177:       <font color=#FF0000>{</font>
178:          String output <font color=#990000>=</font> <font color=#FF0000>""</font><font color=#990000>;</font>
179:          Message m <font color=#990000>=</font> currentMailbox<font color=#990000>.</font><b><font color=#000000>getCurrentMessage</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
180:          <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>m <font color=#990000>=</font><font color=#990000>=</font> <b><font color=#0000FF>null</font></b><font color=#990000>)</font> output <font color=#990000>+</font><font color=#990000>=</font> <font color=#FF0000>"No messages."</font> <font color=#990000>+</font> <font color=#FF0000>"\n"</font><font color=#990000>;</font>
181:          <b><font color=#0000FF>else</font></b> output <font color=#990000>+</font><font color=#990000>=</font> m<font color=#990000>.</font><b><font color=#000000>getText</font></b><font color=#990000>(</font><font color=#990000>)</font> <font color=#990000>+</font> <font color=#FF0000>"\n"</font><font color=#990000>;</font>
182:          output <font color=#990000>+</font><font color=#990000>=</font> MESSAGE_MENU_TEXT<font color=#990000>;</font>
183:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>output<font color=#990000>)</font><font color=#990000>;</font>
184:       <font color=#FF0000>}</font>
185:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"2"</font><font color=#990000>)</font><font color=#990000>)</font>
186:       <font color=#FF0000>{</font>
187:          currentMailbox<font color=#990000>.</font><b><font color=#000000>saveCurrentMessage</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
188:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MESSAGE_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
189:       <font color=#FF0000>}</font>
190:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"3"</font><font color=#990000>)</font><font color=#990000>)</font>
191:       <font color=#FF0000>{</font>
192:          currentMailbox<font color=#990000>.</font><b><font color=#000000>removeCurrentMessage</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
193:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MESSAGE_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
194:       <font color=#FF0000>}</font>
195:       <b><font color=#0000FF>else</font></b> <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key<font color=#990000>.</font><b><font color=#000000>equals</font></b><font color=#990000>(</font><font color=#FF0000>"4"</font><font color=#990000>)</font><font color=#990000>)</font>
196:       <font color=#FF0000>{</font>
197:          state <font color=#990000>=</font> MAILBOX_MENU<font color=#990000>;</font>
198:          phone<font color=#990000>.</font><b><font color=#000000>speak</font></b><font color=#990000>(</font>MAILBOX_MENU_TEXT<font color=#990000>)</font><font color=#990000>;</font>
199:       <font color=#FF0000>}</font>
200:    <font color=#FF0000>}</font>
201: 
202:    <b><font color=#0000FF>private</font></b> MailSystem system<font color=#990000>;</font>
203:    <b><font color=#0000FF>private</font></b> Mailbox currentMailbox<font color=#990000>;</font>
204:    <b><font color=#0000FF>private</font></b> String currentRecording<font color=#990000>;</font>
205:    <b><font color=#0000FF>private</font></b> String accumulatedKeys<font color=#990000>;</font>
206:    <b><font color=#0000FF>private</font></b> Telephone phone<font color=#990000>;</font>
207:    <b><font color=#0000FF>private</font></b> <font color=#009900>int</font> state<font color=#990000>;</font>
208: 
209:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> DISCONNECTED <font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>;</font>
210:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> CONNECTED <font color=#990000>=</font> <font color=#993399>1</font><font color=#990000>;</font>
211:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> RECORDING <font color=#990000>=</font> <font color=#993399>2</font><font color=#990000>;</font>
212:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> MAILBOX_MENU <font color=#990000>=</font> <font color=#993399>3</font><font color=#990000>;</font>
213:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> MESSAGE_MENU <font color=#990000>=</font> <font color=#993399>4</font><font color=#990000>;</font>
214:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> CHANGE_PASSCODE <font color=#990000>=</font> <font color=#993399>5</font><font color=#990000>;</font>
215:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> <font color=#009900>int</font> CHANGE_GREETING <font color=#990000>=</font> <font color=#993399>6</font><font color=#990000>;</font>
216: 
217:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> String INITIAL_PROMPT <font color=#990000>=</font> 
218:       <font color=#FF0000>"Enter mailbox number followed by #"</font><font color=#990000>;</font>      
219:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> String MAILBOX_MENU_TEXT <font color=#990000>=</font> 
220:       <font color=#FF0000>"Enter 1 to listen to your messages\n"</font>
221:       <font color=#990000>+</font> <font color=#FF0000>"Enter 2 to change your passcode\n"</font>
222:       <font color=#990000>+</font> <font color=#FF0000>"Enter 3 to change your greeting"</font><font color=#990000>;</font>
223:    <b><font color=#0000FF>private</font></b> <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>final</font></b> String MESSAGE_MENU_TEXT <font color=#990000>=</font> 
224:       <font color=#FF0000>"Enter 1 to listen to the current message\n"</font>
225:       <font color=#990000>+</font> <font color=#FF0000>"Enter 2 to save the current message\n"</font>
226:       <font color=#990000>+</font> <font color=#FF0000>"Enter 3 to delete the current message\n"</font>
227:       <font color=#990000>+</font> <font color=#FF0000>"Enter 4 to return to the main menu"</font><font color=#990000>;</font>
228: <font color=#FF0000>}</font>
229: 
230: 
231: 
232: 
233: 
234: 
235: 
236: 
237: 
238: 
239: 
</tt>
</pre>
</body>
</html>
